import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import { registerStore } from './stores'
// import Vconsole from 'vconsole'
import 'amfe-flexible'
import { version } from '../package.json'
import('@/styles/index.less')

// import { setupGlobComponents } from './components'
// import { setupGlobDirectives } from './directives'

const baseSize = 37.5
function setRem() {
  const clientWidth = document.documentElement.clientWidth
  const scale = clientWidth / 375
  document.documentElement.style.fontSize = baseSize * Math.min(scale, 1.44) + 'px'
}
// setRem()
// window.onresize = function() {
//   setRem()
// }

// vant函数式组件样式
import 'vant/es/toast/style'
import 'vant/es/dialog/style'
import 'vant/es/notify/style'
import 'vant/es/image-preview/style'

const app = createApp(App)

// setupGlobDirectives(app)
// setupGlobComponents(app, queryParams.appFlag)
registerStore(app)

// if (import.meta.env.VITE_NODE_ENV !== 'production') {
//   let vConsole = new Vconsole()
//   app.use(vConsole)
// }

// console.log(app, 'app')
console.log(
  `%c version %c ${version} %c`,
  'background:#35495e ; padding: 1px; border-radius: 3px 0 0 3px;  color: #fff',
  'background:#2e7efe ; padding: 1px; border-radius: 0 3px 3px 0;  color: #fff',
  'background:transparent'
)

app.use(router).mount('#app')
